package com.glx.learn_spring.learn_spring_02_baseconfig;

import com.glx.learn_spring.learn_spring_02_baseconfig.dao.IBookDao;
import com.glx.learn_spring.learn_spring_02_baseconfig.service.IBookService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class AppForScope {
    public static void main(String[] args) {
        ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");

        IBookDao bookDao1 = ctx.getBean("bookDao",IBookDao.class);
        IBookDao bookDao2 = ctx.getBean("bookDao",IBookDao.class);
        System.out.println(bookDao1);
        System.out.println(bookDao2);

        IBookService bookService1 = ctx.getBean("bookService",IBookService.class);
        IBookService bookService2 = ctx.getBean("bookService",IBookService.class);
        System.out.println(bookService1);
        System.out.println(bookService2);
    }
}
